package oop.multiform;

public class TestMain {

    /*
        不同的动物类都可以执行eat方法，但是不同的动物eat的具体内容不同
     */
    public void eat(Animal ani){
        if(ani instanceof Dog){
            Dog d = (Dog)ani;
            d.sing();
        }else if(ani instanceof Tiger){
            Tiger t = (Tiger)ani;
            t.sing();
        }
    }

    public static void main(String[] args) {

//        Tiger tiger = new Tiger();
//
//        Animal dog = new Dog();
//        dog.sing();
//        dog.dance();

        TestMain testMain = new TestMain();
        testMain.eat(new Dog());
        testMain.eat(new Tiger());
    }

}
